/**
 * Creat with IntelliJ IDEA
 * Description:
 * User:WZW
 * Date:2022-04-23
 * Time:7:53
 */
public class Demo10 {
    public static void main(String[] args) {
        Thread B = new Thread(()->{
            System.out.println("B还在赶作业，等一等马上好！");
            try {
                Thread.sleep(5000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println("B终于赶完作业了，赶紧交给课代表A~");
        });
        B.start();

        Thread A = new Thread(()->{
            System.out.println("就差B的作业了……");
            try {
                B.join();//等待B完成作业
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println("A收齐作业，送到老师办公区了~");
        });
        A.start();

    }
}
